package com.sure.user.service.model;

import java.util.ArrayList;
import java.util.List;

import javax.validation.Valid;

import com.sure.common.anotation.PO;
import com.sure.common.dao.model.JoinCase;
import com.sure.common.service.model.BaseVO;
import com.sure.user.dao.model.DepartmentPO;
import com.sure.user.dao.model.EmployeePO;

/**
 * 雇员查询结果VO
 * 
 * @author Sure
 *
 */
public class EmpVO implements BaseVO{
	@PO
	@Valid
	private EmployeePO emp;
	@PO
	private DepartmentPO dept;
	
	public EmployeePO getEmp() {
		return emp;
	}
	public void setEmp(EmployeePO emp) {
		this.emp = emp;
	}
	public DepartmentPO getDept() {
		return dept;
	}
	public void setDept(DepartmentPO dept) {
		this.dept = dept;
	}
	
	@Override
	public String getMainTable() {
		return EmployeePO.TABLE_NAME;
	}
	@Override
	public List<JoinCase> getJoinCase() {
		List<JoinCase> cases = new ArrayList<JoinCase>();
		//连接部门信息表
		JoinCase case1 = new JoinCase();
		case1.setColumn(EmployeePO.PROP_DEPTID);
		case1.setJoinColumn(DepartmentPO.PROP_ID);
		case1.setJoinTable(DepartmentPO.TABLE_NAME);
		cases.add(case1);
		
		return cases;
	}
	
	/**
	 * 默认返回字段方法
	 * @return
	 */
	@Override
	public List<String> getReturnCols() {
		List<String> props = new ArrayList<String>();
		props.add(EmployeePO.PROP_ID);
		props.add(EmployeePO.PROP_NAME);
		props.add(EmployeePO.PROP_JOB);
		props.add(EmployeePO.PROP_SALARY);
		props.add(EmployeePO.PROP_HIREDATE);
		props.add(DepartmentPO.PROP_NAME);
		return props;
	}
	
}
